package com.page.demo.controller;

import com.page.demo.dao.CarDao;
import com.page.demo.dao.impl.CarDaoImpl;
import com.page.demo.pojo.Car;
import com.page.demo.pojo.ov.CarAndBrand;
import com.page.demo.service.CarService;
import com.page.demo.service.Impl.CarServiceImpl;
import org.junit.Test;

import java.util.List;

public class CarController {
    private CarService carService = new CarServiceImpl();

    @Test
    // 查询所有
    public void inquireAll(){
        List<Car> carList = carService.queryAll();
        carList.forEach(System.out::println);
    }
    @Test
    // 根据价格升序排序
    public void inquireByPriceAsc(){
        List<Car> carList = carService.queryByPriceAsc();
        carList.forEach(System.out::println);
    }

    @Test
    // 根据价格降序排序
    public void inquireByPriceDesc(){
        List<Car> carList = carService.queryByPriceDesc();
        carList.forEach(System.out::println);
    }

    public List<CarAndBrand>  searchBrandCar(String brand){
        List<CarAndBrand> list = carService.searchBrandCar(brand);
        return list;
    }

}
